<!---GUI FOR THE LINKING OF EFORMS FOR THE EDTR--->
<!---BY MICO--->

<CFIF THETABLE NEQ "#GETRECORD.TKFILENAME_FK#PX">
	<CFFORM METHOD="post" NAME="frmNEWAPP" format="html">
		<TABLE BORDER=0 CELLPADDING=2 CELLSPACING=2 BGCOLOR="#client.color_tblhead#" WIDTH="100%" HEIGHT=33>
			<TR>
				<TD CLASS="white" NOWRAP>
					&nbsp;
					<CFINPUT TYPE="submit" NAME="btnSAVELINKS"  VALUE="Save" CLASS="bitbtn">
					<CFINPUT TYPE="submit" NAME="Cancel" VALUE="Back" CLASS="bitbtn">
				</TD>
			</TR>
		</TABLE>
	<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=5 WIDTH="100%">
			<CFOUTPUT>
			<TR VALIGN="bottom">
				<TD ALIGN="right"><IMG SRC="#client.image_path##session.site_ibose#"></TD>
				<TD NOWRAP CLASS="bold14" WIDTH="100%"><FONT FACE="Impact" SIZE="+2">#client.companyname#</FONT><BR>#THETITLE#</TD>
			</TR>
			</CFOUTPUT>
		</TABLE>
	<TABLE BORDER=0 CELLPADDING=1 CELLSPACING=0  WIDTH="100%">
		<TR height="10"></TR>
		<CFOUTPUT>
		<CFQUERY name="getNOTAPPROVED" dbtype="query">
			SELECT *
			FROM GETCONTENTS
			WHERE APPROVED NOT IN ('Y','C','N')
		</CFQUERY>
		<CFIF getNOTAPPROVED.RECORDCOUNT>
			<CFQUERY name="VALIDATEPREPROCESS" datasource="#CLIENT.COMPANY_DSN#">
				SELECT PREPROCESS
				FROM ECRGFORMS
				WHERE FORMCODE = '#THEFORMCODE#'
			</CFQUERY>
			<TR>
			<TD width="3%">&nbsp;</TD>
			<TD align="center">VALIDATION REMARKS</TD>
			<CFLOOP query="GETBROWSEFIELDS">
				<TD align="center">#COLUMNNAME#</TD>
			</CFLOOP>
			</TR>
			<TR height="10">&nbsp;</TR>
			<CFLOOP QUERY = "getNOTAPPROVED">
				<CFIF VALIDATEPREPROCESS.PREPROCESS NEQ "">
					<CFSILENT>
					<CFSET lPreProcessShowMsg = "YES">
					<CFSET lPreProcessValidated = "NO">
					<CFSET sEDTRMESS = "">
					<CFQUERY name="GETENTRY" datasource="#CLIENT.COMPANY_DSN#">
						SELECT *
						FROM #THETABLE#
						WHERE DOCNUMBER = '#DOCNUMBER#'
					</CFQUERY>
					<CFINCLUDE template="../../eforms/pre_activities/#VALIDATEPREPROCESS.PREPROCESS#">
					</CFSILENT>
				</CFIF>
				<TR bgcolor="#IIf(CurrentRow Mod 2, "client.color_tblset2", "client.color_tblset1")#" valign="top">
				<CFSET AROW = CURRENTROW>
				<CFPARAM NAME = "lPreProcessValidated" default="YES">
				<CFPARAM NAME = "sEDTRMESS" default="">
				<CFIF lPreProcessValidated>
					<CFIF LISTFINDNOCASE(VALUELIST(qryECINDTRUPDATEDTL.DOCNUMBER_FK),"#DOCNUMBER#")>
						<TD align="center" valign="middle"><CFINPUT type="checkbox" checked="yes" name="chkDOCNUMBER" value="#DOCNUMBER#" /></TD>
					<CFELSE>
						<TD align="center" valign="middle"><CFINPUT type="checkbox" name="chkDOCNUMBER" value="#DOCNUMBER#" /></TD>
					</CFIF>
					<TD align="center" valign="middle">VALID <CFIF sEDTRMESS NEQ "">(#sEDTRMESS#)</CFIF></TD>
				<cfelse>
				  <TD width="3%" align="center" valign="middle"><CFINPUT type="checkbox" name="chkDOCNUMBER" value="#DOCNUMBER#" disabled="disabled" /></TD><TD width="19%" align="center" valign="middle">INVALID<CFIF sEDTRMESS NEQ "">(#sEDTRMESS#)</CFIF></TD>
				</CFIF>
				<CFINPUT type="hidden" name="hidDOCNUMS" value="#DOCNUMBER#">
				<CFLOOP query="GETBROWSEFIELDS">
					<CFIF COLUMNTYPE NEQ "ftDateTime">
						<TD align="center" valign="middle">#EVALUATE("getNOTAPPROVED.#COLUMNNAME#[AROW]")#</TD>
					<CFELSE>
						<TD align="center" valign="middle">#DATEFORMAT(EVALUATE("getNOTAPPROVED.#COLUMNNAME#[AROW]"))#</TD>
					</CFIF>
				</CFLOOP>
				</TR>
			</CFLOOP>
			<CFINPUT type="hidden" name="hidPID" value="#PID#">
		<CFELSE>
			<TR></TR><TR><TD colspan="3" align="center">You have no applications that may be linked to the eDTR. (Note: applications which are already acted upon can not be linked to the eDTR)</TD></TR>
		</CFIF>
		</CFOUTPUT>
	</TABLE>	
	</CFFORM>
<CFELSE>
	<CFFORM METHOD="post" NAME="frmNEWAPP" format="html">
		<TABLE BORDER=0 CELLPADDING=2 CELLSPACING=2 BGCOLOR="#client.color_tblhead#" WIDTH="100%" HEIGHT=33>
			<TR>
				<TD CLASS="white" NOWRAP>
					&nbsp;
					<CFINPUT TYPE="submit" NAME="btnSAVELINKS"  VALUE="Save" CLASS="bitbtn">
					<CFINPUT TYPE="submit" NAME="Cancel" VALUE="Back" CLASS="bitbtn">
				</TD>
			</TR>
		</TABLE>
	<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=5 WIDTH="100%">
			<CFOUTPUT>
			<TR VALIGN="bottom">
				<TD ALIGN="right"><IMG SRC="#client.image_path##session.site_ibose#"></TD>
				<TD NOWRAP CLASS="bold14" WIDTH="100%"><FONT FACE="Impact" SIZE="+2">#client.companyname#</FONT><BR>#THETITLE#</TD>
			</TR>
			</CFOUTPUT>
		</TABLE>
	<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=5 WIDTH="50%">
		<CFOUTPUT>
		<CFIF GETCONTENTS.RECORDCOUNT>
			<TR>
			</TR>
			<tr bgcolor="#CLIENT.color_grphead#" valign="top">
				<TD></TD>
				<TD align="center"><strong>REFERENCE DATE</strong></TD>
				<TD align="center"><strong>PAIRTIME</strong></TD>
				<TD align="center"><strong>SWIPETYPE</strong></TD>
				<TD align="center"><strong>REMARKS</strong></TD>
			</TR>
			<CFLOOP QUERY = "GETCONTENTS">
				<CFIF PAIRTIME NEQ " ">
					<TR>
					<CFSET AROW = CURRENTROW>
					<CFSET PRESENT = FALSE>
					<CFLOOP query="qryECINDTRUPDATEDTL">
						<CFSET BROW = CURRENTROW>
						<CFIF LISTFINDNOCASE("#DOCNUMBER_FK#",GETCONTENTS.SEQUENCENO[AROW])>
							<CFSET theSNROW = BROW>
							<CFSET PRESENT = TRUE>
							<CFSET SWIPEVAL = LISTGETAT("#DOCNUMBER_FK#",2)>
							<CFBREAK>
						</CFIF>
					</CFLOOP>
					<CFIF PRESENT>
						<TD><CFINPUT type="checkbox" checked="yes" name="SEQUENCENO" value="#SEQUENCENO#" /></TD>
					<CFELSE>
						<TD><CFINPUT type="checkbox" name="SEQUENCENO" value="#SEQUENCENO#" /></TD>
					</CFIF>
					<CFINPUT type="hidden" name="hidSEQUENCENOS" value="#SEQUENCENO#">
					<CFLOOP LIST = "REFERENCEDATE,PAIRTIME,SWIPETYPE,REMARKS" index="THEFIELD">
						<CFIF THEFIELD NEQ "REFERENCEDATE" AND THEFIELD NEQ "SWIPETYPE">
							<TD>#EVALUATE("GETCONTENTS.#THEFIELD#[AROW]")#</TD>
						<CFELSE>
							<CFIF THEFIELD EQ "SWIPETYPE">
							<TD>
							<cfselect name="sel#SEQUENCENO#">
								<option value = "IN" <CFIF PRESENT AND SWIPEVAL EQ "IN"> SELECTED = "SELECTED" <CFELSEIF NOT PRESENT AND SWIPETYPE EQ "IN"> SELECTED = "SELECTED" </CFIF> > IN </option>
								<option value = "OUT"  <CFIF PRESENT AND SWIPEVAL EQ "OUT"> SELECTED = "SELECTED" <CFELSEIF NOT PRESENT AND SWIPETYPE EQ "OUT"> SELECTED = "SELECTED" </CFIF> > OUT </option>
							</cfselect>
							</TD>
							<CFELSE>
							<TD>#DATEFORMAT(EVALUATE("GETCONTENTS.#THEFIELD#[AROW]"))#</TD>
							</CFIF>
						</CFIF>
					</CFLOOP>
					</TR>
				</CFIF>
			</CFLOOP>
		</CFIF>
		</CFOUTPUT>
	</TABLE>	
	</CFFORM>
</CFIF>
	